
//% color="#df9e5d" iconWidth=50 iconHeight=40
namespace WonderEcho {

    //% block="WonderEcho setup I2C mode address 0x34" blockType="command"
    export function init(parameter: any, block: any) {

        Generator.addImport(`from WonderEcho import WonderEchoModule\n`);
        Generator.addCode(`wonder_echo = WonderEchoModule()`);
 
    }
    
		//% block="---"
    export function noteSep2() {

    }
    
    //% block="get the result" blockType="reporter"
    export function readCMDID(parameter: any, block: any) {
        Generator.addCode(["wonder_echo.rec_recognition()", Generator.ORDER_UNARY_POSTFIX]);
    }
    
    //% block="---"
    export function noteSep2() {

    }
    
    //% block="play command word [ID]" blockType="command"
    //% ID.shadow="number"   ID.defl=1
    export function playByCMDID(parameter: any, block: any) {
        let id=parameter.ID.code;

        Generator.addCode(`wonder_echo.speak(0x00, ${id})`);
 
    }
    
    //% block="play announcement [ID]" blockType="command"
    //% ID.shadow="number"   ID.defl=1
    export function playByANCID(parameter: any, block: any) {
        let id=parameter.ID.code;

        Generator.addCode(`wonder_echo.speak(0xFF, ${id})`);
    }
}
